# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1SchemaSchemaField do
  @moduledoc """
  Represents a column field within a table schema.

  ## Attributes

  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. User friendly field description. Must be less than or equal to 1024 characters.
  *   `fields` (*type:* `list(GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1SchemaSchemaField.t)`, *default:* `nil`) - Optional. Any nested field for complex types.
  *   `mode` (*type:* `String.t`, *default:* `nil`) - Required. Additional field semantics.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Required. The name of the field. Must contain only letters, numbers and underscores, with a maximum length of 767 characters, and must begin with a letter or underscore.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Required. The type of field.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :description => String.t() | nil,
          :fields =>
            list(GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1SchemaSchemaField.t()) | nil,
          :mode => String.t() | nil,
          :name => String.t() | nil,
          :type => String.t() | nil
        }

  field(:description)

  field(:fields,
    as: GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1SchemaSchemaField,
    type: :list
  )

  field(:mode)
  field(:name)
  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1SchemaSchemaField do
  def decode(value, options) do
    GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1SchemaSchemaField.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Dataplex.V1.Model.GoogleCloudDataplexV1SchemaSchemaField do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
